package com.kgc.cgprovider.controller;

import com.kgc.cgapi.pojo.CGSQPojo;
import com.kgc.basic.util.ResponseMsg;
import com.kgc.cgapi.service.CGSQServiceApi;
import com.kgc.cgprovider.service.CGSQService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class CGSQController implements CGSQServiceApi {

    private Logger logger = LoggerFactory.getLogger(CGSQController.class);

    @Autowired
    private CGSQService cgsqService;

    @Override
    public ResponseMsg getCGSQ(String code) {
        logger.info("getCGSQ code:{}", code);
        ResponseMsg responseMsg = cgsqService.getCGSQPojo(code);
        logger.info("getCGSQ responseMsg:{}", responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg getCGSQInfo(String code) {
        logger.info("getCGSQInfo code:{}", code);
        ResponseMsg responseMsg = cgsqService.getCGSQInfo(code);
        logger.info("getCGSQInfo responseMsg:{}", responseMsg);
        return responseMsg;
    }



    @Override
    public ResponseMsg getCGSQPage(Map<String, Object> param) {
        logger.info("getPage map"+param);
        ResponseMsg responseMsg = cgsqService.getPage(param);
        return responseMsg;
    }

    @Override
    public ResponseMsg addCGSQ(Map<String, Object> param ) {
        logger.info("addCGSQ cgsq{}" , param);
        ResponseMsg responseMsg = cgsqService.addCGSQ(param);
        logger.info("addCGSQ cgsq {} param{}" , responseMsg , param);
        return responseMsg;
    }

    @Override
    public ResponseMsg addCGSQInfo(Map<String, Object> param) {
        logger.info("addCGSQInfo cgsq{}" , param);
        ResponseMsg responseMsg = cgsqService.addCGSQInfo(param);
        logger.info("addCGSQInfo cgsq {} param{}" , responseMsg , param);
        return responseMsg;
    }

    @Override
    public ResponseMsg modiCGSQ(Map<String, Object> param) {
        logger.info("modiCGSQ cgsq{}" , param);
        ResponseMsg responseMsg = cgsqService.modiCGSQ(param);
        logger.info("modiCGSQ cgsq {} param{}" , responseMsg , param);
        return responseMsg;
    }

    @Override
    public ResponseMsg modiCGSQInfo(Map<String, Object> param) {
        logger.info("modiCGSQInfo cgsq{}" , param);
        ResponseMsg responseMsg = cgsqService.modiCGSQInfo(param);
        logger.info("modiCGSQInfo cgsq {} param{}" , responseMsg , param);
        return responseMsg;
    }


}
